import { createStore } from 'vuex'

// 创建一个新的 store 实例
const store = createStore({
  state () {
    return {
      userInfo: null,
      isLogin : false,
      isNewUser : false
    }
  },
  mutations: {
    login(state, payload){
      state.userInfo = payload
      state.isLogin = true
    },
    logout(state){
      state.isLogin = false
      state.userInfo = null
    },
    newUser(state){
      state.isNewUser = true
    },
    updateInfo(state,info){
      state.userInfo = info
    }
  }
})

export default store